package cn.maidouya.hrm.controller;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping
public class AuthenController {
    @PostMapping("/success")
    public String getSuccess(){
        Authentication security = SecurityContextHolder.getContext().getAuthentication();
        Object principal = security.getPrincipal();
        System.out.println("principal:  "+ principal.toString());
        Object credentials = security.getCredentials();
        System.out.println("credentials" + credentials);
        String name = security.getName();
        System.err.println("name：" + name.toString());
        System.err.println("权限：" + security.toString());
        return "登录成功";
    }
}